<?php


class Application_Form_VirtualHost extends EW_Form_Base {

    protected function _initialize() {
        // Set the method for the display form to POST
        $this->setMethod(self::METHOD_POST);
        
        // Form Decorator Element Space
        $formElementSpace = new Zend_Form_Decorator_HtmlTag(array(
                'tag' => 'div',
                'class' => 'formElementSpace', 
                'placement' => Zend_Form_Decorator_Abstract::APPEND
            ));
        
        /*
         * Id Hidden Field
         */
        $fieldId = new Zend_Form_Element_Hidden('id');
        $fieldId->setValue(0);
        $fieldId->setDecorators(array('ViewHelper'));
        $this->addElement($fieldId);
        
        /*
         * Project Id Hidden Field
         */
        $fieldProjectsId = new Zend_Form_Element_Hidden('projects_id');
        $fieldProjectsId->setValue(0);
        $fieldProjectsId->setDecorators(array('ViewHelper'));
        $this->addElement($fieldProjectsId);
        
        // Server Alias
        $this->addElement('text', 'ServerAddress', array (
            'label'      => 'Server Address:',
            'required'   => true, 
            'validators' => array('Ip')
        ));
        
        // Server Alias
        $this->addElement('text', 'ServerPort', array (
            'label'      => 'Server Port:',
            'required'   => true,
            'validators' => array('Alnum')
        ));
        
        // Admin Email
        $this->addElement('text', 'ServerAdmin', array(
            'label'      => 'Server Admin:',
            'required'   => true,
            'filters'    => array('StringTrim'),
            'validators' => array('EmailAddress')
        ));
        
        // Server Name
        $this->addElement('text', 'ServerName', array (
            'label'      => 'Server Name:',
            'required'   => true
        ));
        
        // Server Alias
        $this->addElement('text', 'ServerAlias', array (
            'label'      => 'Server Alias:',
            'required'   => true
        ));
        
        // Server Document Root
        $this->addElement('text', 'DocumentRoot', array(
            'label'      => 'Document Root:',
            'required'   => true,
            'filters'    => array('StringTrim'),
            'validators' => array()
        ));
        
        // Add the submit button
        $this->addElement('submit', 'submit', array (
            'ignore'   => true,
            'label'    => 'Save',
        ));
        
        // Add Field Bottom Margin 
        $this->ServerAddress->addDecorator(array('formElementSpace' => $formElementSpace));
        $this->ServerPort->addDecorator(array('formElementSpace' => $formElementSpace));
        $this->ServerAdmin->addDecorator(array('formElementSpace' => $formElementSpace));
        $this->ServerName->addDecorator(array('formElementSpace' => $formElementSpace));
        $this->ServerAlias->addDecorator(array('formElementSpace' => $formElementSpace));
        $this->DocumentRoot->addDecorator(array('formElementSpace' => $formElementSpace));
    }
    //===============================================================================
    
    /**
     * (non-PHPdoc)
     * @see EW_Form_Base::_save()
     */
    protected function _save() {
        
    }
    
    /**
     * @see EW_Form_DbObject::_beforeSave()
     */
    protected function _beforeSave() {
    
    }
    //================================================================================
    
    /**
     * 
     * @see EW_Form_DbObject::_afterSave()
     */
    protected function _afterSave() {
        
    }
    //================================================================================
    
    /**
     * Initialize decorators
     */
    protected function _initDecorators() {
        
    }
    //================================================================================
    
};
